[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 cprintf()               Formatted Write to Console

 #include <conio.h>

 int        cprintf(format-string[,argument...]);
 const char *format-string;              format control string

    cprintf() formats and prints a series of characters and/or values to
    the current text window.  putch() is used to output single
    characters.

    The format string and arguments for cprintf() are the same as those
    for printf().  See the description of the printf() function for a
    detailed explanation of the format string and arguments.

       Returns:     The number of characters printed.

         Notes:     Unlike fprintf(), printf(), and sprintf(), cprintf()
                    doesn't translate line-feed characters into carriage-
                    return-line-feed pairs.

   Portability:     IBM PC and compatibles only.

   -------------------------------- Example ---------------------------------
    The following statements produce formatted output of characters,
    strings, and integers.

           #include <stdio.h>

           char *str6 = "output";
           int num1 = 5000, num2 = 6;
           double dbl = 5871.115;
           char c1 = 'x', c2 = 'y', c3 = 'z';

           main()
           {
               cprintf("%d + %d = %d\r\n",num1,num2,num1+num2);
               cprintf("Print the string \"%s\" in
                      the middle of this text.\r\n",str6);
               cprintf("\r\n\r\n");
               cprintf("   %f   %.3f   %E\r\n",dbl,dbl,dbl);
               cprintf("%c, %c, %c    ",c1,c2,c3);
               cprintf("%c, %c, %c \r\n",c3,c2,c1);
           }


See Also: printf() putch()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson